package com.dhz.common.monitor;

/**
 * 统计数据  - REST API
 *
 * @author FY
 * @since 1.0
 */
public class StatisticsRest extends Statistics {
    /** 若是REST调用统计，则url字段将会被启用，其值为该REST API */
    private String url;

    /**
     * REST API Statistics Constructor
     * @param url           rest api
     * @param application   应用名称
     * @param service       服务(接口)名称
     * @param method        调用借口方法名称
     * @param group         服务所属分组
     * @param version       服务版本
     * @param client        客户端地址[IP|DOMAIN]
     * @param server        服务端地址[IP|DOMAIN]
     */
    public StatisticsRest(String url, String application, String service, String method, String group, String version, String client, String server) {
        super(application, service, method, group, version, client, server);
        this.url = url;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + ((url == null) ? 0 : url.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (!super.equals(obj)) {
            return false;
        }
        StatisticsRest other = (StatisticsRest) obj;
        if (url == null) {
            if (other.url != null) {
                return false;
            }
        } else if (!url.equals(other.url)) {
            return false;
        }
        return true;
    }
}
